From 5519fdc24af5a81d62547b094dbb9cd5ce1c7b3a Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sat, 15 Oct 2005 08:52:22 +0100 Subject: [PATCH] Extend VCPUINFO dom0_op to return status information about run state of the VCPU. VCPUCONTEXT returns info about hotplugged VCPUs. Signed-off-by: Keir Fraser --- xen/common/dom0_ops.c | 8 +++++--- xen/include/public/dom0_ops.h | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index 9541adbbf8..5d1f17adc7 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -447,7 +447,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) ret = -ESRCH; v = d->vcpu[op->u.getvcpucontext.vcpu]; - if ( (v == NULL) || test_bit(_VCPUF_down, &v->vcpu_flags) ) + if ( (v == NULL) || !test_bit(_VCPUF_initialised, &v->vcpu_flags) ) goto getvcpucontext_out; ret = -ENOMEM; @@ -490,10 +490,12 @@ long do_dom0_op(dom0_op_t *u_dom0_op) goto getvcpuinfo_out; ret = -ESRCH; - v = d->vcpu[op->u.getvcpuinfo.vcpu]; - if ( (v == NULL) || test_bit(_VCPUF_down, &v->vcpu_flags) ) + if ( (v = d->vcpu[op->u.getvcpuinfo.vcpu]) == NULL ) goto getvcpuinfo_out; + op->u.getvcpuinfo.online = !test_bit(_VCPUF_down, &v->vcpu_flags); + op->u.getvcpuinfo.blocked = test_bit(_VCPUF_blocked, &v->vcpu_flags); + op->u.getvcpuinfo.running = test_bit(_VCPUF_running, &v->vcpu_flags); op->u.getvcpuinfo.cpu_time = v->cpu_time; op->u.getvcpuinfo.cpu = v->processor; op->u.getvcpuinfo.cpumap = v->cpumap; diff --git a/xen/include/public/dom0_ops.h b/xen/include/public/dom0_ops.h index 9402feb30e..9556d43f57 100644 --- a/xen/include/public/dom0_ops.h +++ b/xen/include/public/dom0_ops.h @@ -365,7 +365,10 @@ typedef struct { domid_t domain; /* domain to be affected */ uint16_t vcpu; /* vcpu # */ /* OUT variables. */ - uint64_t cpu_time; + uint8_t online; /* currently online (not hotplugged)? */ + uint8_t blocked; /* blocked waiting for an event? */ + uint8_t running; /* currently scheduled on its CPU? */ + uint64_t cpu_time; /* total cpu time consumed (ns) */ uint32_t cpu; /* current mapping */ cpumap_t cpumap; /* allowable mapping */ } dom0_getvcpuinfo_t; -- 2.30.2